package com.wondertek.poms.core.filter.impl;

import com.wondertek.poms.core.filter.BaseRuleFilter;
import com.wondertek.poms.core.filter.RuleFilterChain;
import com.wondertek.poms.dao.po.*;


/**
 * <p><b>CopyRightScopeFilter Description:</b> 版权类型过滤器</p>
 * @author douzi
 * <b>DATE</b> 2019年9月27日 下午4:42:09
 */
public class CopyRightTypeFilter extends BaseRuleFilter {

	@Override
	public void doFilter(IRulePo rule, Content c, RuleFilterChain chain) {
		if (rule instanceof PrdInfoRule) {
			PrdInfoRule r = (PrdInfoRule) rule;
			this.baseFilter(r.getPrdRuleId(), r.getCopyrightType(), c.getCopyrightType(), chain, "版权类型");
		} else if (rule instanceof DefaultPrdSal) {
			DefaultPrdSal r = (DefaultPrdSal) rule;
			this.baseFilter(r.getId(), 
					r.getCopyRightType(), 
					c.getCopyrightType(), 
					chain, 
					"版权类型-CopyrightType");
		} else if (rule instanceof PcProductRule) {
			PcProductRule r = (PcProductRule) rule;
			this.baseFilter(r.getId(), 
					r.getCopyrightType() != null ? r.getCopyrightType() : "", 
					c.getCopyrightType(),
					chain, 
					"版权类型-CopyrightType");
		}
		chain.doFilter(rule, c, chain);
	}

}
